﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel.DomainServices.Client;
using AbstraX.TypeMappings;

namespace AbstraX.ClientInterfaces
{
    public static class BindingsTreeExtensions
    {
        public static string GetID(this Entity entity)
        {
            var id = (string) entity.GetType().GetProperty("ID").GetGetMethod().Invoke(entity, null);

            return id;
        }

        public static string GetParentID(this Entity entity)
        {
            var parentId = (string) entity.GetType().GetProperty("ParentID").GetGetMethod().Invoke(entity, null);

            return parentId;
        }

        public static string GetName(this Entity entity)
        {
            var name = (string) entity.GetType().GetProperty("Name").GetGetMethod().Invoke(entity, null);

            return name;
        }

        public static bool GetHasChildren(this Entity entity)
        {
            var hasChildren = (bool) entity.GetType().GetProperty("HasChildren").GetGetMethod().Invoke(entity, null);

            return hasChildren;
        }

        public static float GetChildOrdinal(this Entity entity)
        {
            var ordinal = (float) entity.GetType().GetProperty("ChildOrdinal").GetGetMethod().Invoke(entity, null);

            return ordinal;
        }
   }
}
